package com.xt.purchasingsystem.service.impl.productionManagementServiceImpl;

import com.xt.purchasingsystem.dto.ProductionprocessesDto;
import com.xt.purchasingsystem.mapper.ProductionprocessesMapper;
import com.xt.purchasingsystem.model.Productionprocesses;
import com.xt.purchasingsystem.service.productionManagementService.ProductionprocessesService;
import com.xt.purchasingsystem.utils.PageBean;
import com.xt.purchasingsystem.utils.Result;
import com.xt.purchasingsystem.utils.ResultFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * 产品生产工序管理的业务实现类
 * Author: 老姚
 * Date:  2020/3/16 20:35
 */
@Service
@Transactional

public class ProductionprocessesServiceImpl implements ProductionprocessesService {
    @Autowired
    private ProductionprocessesMapper productionprocessesMapper;
    @Override
    public Result queryProductionprocessesByPaging(ProductionprocessesDto productionprocessesDto) {
        int rowCount = productionprocessesMapper.rowCount();
        PageBean pageBean=new PageBean(productionprocessesDto.getPageSize(),productionprocessesDto.getCurrNo(),rowCount);
        List<Productionprocesses> productionprocesses = productionprocessesMapper.queryAllByPaging(pageBean.getStart(), pageBean.getEnd());
        pageBean.setPageList(productionprocesses);
        return ResultFactory.buildSuccessResult("查询成功",pageBean);
    }
}
